//
//  KAERecordManager.h
//  StudyDemo
//
//  Created by 陶涛 on 2018/8/22.
//  Copyright © 2018年 陶涛. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>

@protocol KAERecordManagerDelegate;

@interface KAERecordManager : NSObject

@property (nonatomic, strong) AVCaptureSession *session;

@property (nonatomic, assign) AVCaptureVideoOrientation orientation;

@property (nonatomic, strong) AVCaptureDeviceInput *videoInput;

@property (nonatomic, strong) AVCaptureDeviceInput *audioInput;

@property (nonatomic, strong) AVCapturePhotoOutput *stillImageOutput;

@property (nonatomic, assign) id deviceConnectedObserver;

@property (nonatomic, assign) id deviceDisconnectedObserver;

@property (nonatomic, assign) UIBackgroundTaskIdentifier backgroundRecordingID;

@property (nonatomic, weak) id<KAERecordManagerDelegate> delegate;

- (void)setupSession;
- (void)startRecording;
- (void)stopRecording;
- (void)captureStillImage;
- (BOOL)toggleCamera;
- (NSUInteger)cameraCount;
- (NSUInteger)micCount;
- (void)autoFoucusAtPoint:(CGPoint)point;
- (void)continuousFocusAtPoint:(CGPoint)point;

@end

@protocol KAERecordManagerDelegate<NSObject>

@optional
- (void)recordManager:(KAERecordManager *)manager didFailWithError:(NSError *)error;
- (void)recordMangerRecordingBegan:(KAERecordManager *)manager;
- (void)recordMangerRecordingFinished:(KAERecordManager *)manager;
- (void)recordMangerStillImageCaptured:(KAERecordManager *)manager;
- (void)recordMangerDeviceConfigurationChanged:(KAERecordManager *)manager;


@end
